package com.yww.algorithm.recursion.fibonacci;

/**
 * @author yww
 * @description 爬楼梯 递归
 * @since 2024/1/31 14:57
 */
public class ClimbStairs {

    // 爬第n层楼梯的方法，一次只能跨一步或者是二步(未优化)
    public static int climb01(int n) {
        if (n <= 1) {
            return 1; //
        }
        if (n == 2) {
            return 2;
        }
        return climb01(n - 1) + climb01(n - 2);
    }

    public static void main(String[] args) {
        System.out.println(climb01(3));
        System.out.println(climb01(4));
    }
}
